<?php
/**
 * Exception personnalisée pour les feeds
 *
 * @package zfbook
 * @subpackage feed
 */
class Zfbook_Feed
{
    /**
     * @var Zend_Feed_Abstract
     */
    private $_feed = null;

    public function setClass($class)
    {
        $server = new $class;
        $this->_feed = Zend_Feed::importArray($server->getRssArray(), 'rss');
    }

    public function handle()
    {
        if (!($this->_feed instanceof Zend_Feed_Abstract)) {
            throw new Zfbook_Feed_Exception("Feed unknown");
        }
        $this->_feed->send();
    }
}
